type
	vector=record
		a:array of int64;
	end;

procedure new(var v:vector);
begin
setlength(v.a,0);
end;
	
procedure push(var v:vector; n:int64);

var
	tt:longint;
	
begin
tt:=length(v.a);
setlength(v.a,tt+1);
v.a[tt]:=n;
end;

function pop(var v:vector):int64;

var
	tt:longint;
	
begin 
tt:=length(v.a);
if tt=0 then begin
	result:=-maxlongint;
	exit;
end;
result:=v.a[tt];
setlength(v.a,tt-1);
end;